package com.stoneframe.controller.manageTraffic;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.stoneframe.controller.base.BaseGenericController;
import com.stoneframe.service.BaseService;
import com.stoneframe.service.manageTraffic.TrafFenceService;
import com.stoneframe.util.baseApp.AppHelper;
import com.stoneframe.util.baseApp.PageData;
import com.stoneframe.util.baseApp.ToolHelper;

@Controller
@RequestMapping(value="trafFence")
public class TrafFenceController extends BaseGenericController {
	
	@Resource(name="trafFenceService")
	private TrafFenceService trafFenceService; 

	@Override
	public BaseService getService() {
		// TODO Auto-generated method stub
		return trafFenceService;
	}
	
	@ResponseBody
	@RequestMapping(value="editRule")
	public Object editRule(){
		logBefore(logger, className+"editRule");
		
		PageData pd=this.getPageData();
		
		try{
			if(ToolHelper.notEmpty(pd.getString("keyValue"))){
				trafFenceService.editRule(pd);
			}
			return AppHelper.successObject("操作成功！");
		}catch(Exception e){
			logger.error(e.getMessage(), e);
			return AppHelper.errorObject("操作失败！"+e.getMessage());
		}
	}

}
